function abc(a, b) {
    return a + b;
}


var a = abc(8, 16);
console.log(a);

let b = 'banana';
console.log(b);


$('#tst').text('sss')

// $.get('/admin/proxy.php', {
//     getType: 'getList',
//     num: 7
// }).done(function(res){
//     console.log(res)
// })

var option = {
    type: 'get',
    url: '/admin/proxy.php',
    data: {
        id: 1
    }
}
var result = requestEvent(option);

result.then(function (res) {
    console.log(res);
    return res;
}, function (error) {
    console.log(error);
    return error;
}).then(function (data) {
    console.log(data);
}, function (e) {
    console.log(e)
})

function requestEvent(option) {
    var def = $.Deferred();
    if (!option){
        def.reject('request option is undefined.');
        return def.promise();
    }
    if (option && !option.type) {
        def.reject('what request type do you want?');
        return def.promise();
    }
    if (option && !option.url) {
        def.reject('where is the url?');
        return def.promise();
    }
    if (option && !option.data) {
        option.data = {};
    }
    $.ajax({
        type: option.type,
        url: option.url,
        data: option.data,
        dataType: 'json',
        success: function (res) {
            def.resolve(res);
        },
        error: function () {
            def.reject('error');
        }
    });
    return def.promise();
}


///http://localhost/rongshengda5/admin/pro_list.php?getType=getList&num=7